#lang racket

(define (cont-frac n d k)
  (define (iter i result)
    (if (= i 0)
        result
        (iter (- i 1) (/ (n i) (+ (d i) result)))))
    (iter k 0))

(define (euler-d i)
  (if(= (remainder (+ i 1) 3) 0)
     (* 2 (/ (+ i 1) 3))
     1))

(cont-frac (lambda (x) 1.0) euler-d 1000)